<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="<%=basePath %>css/pagination.css">
        <link rel="stylesheet" href="<%=basePath %>css/cssreset.css">
        
        <link rel="stylesheet" href="<%=basePath %>css/style2.css">
		<script src="<%=basePath %>js/jquery-1.11.1.min.js"></script>
		<script language="javascript" src="<%=basePath %>js/PCASClass.js"></script>
		 <script>
		       $(function(){
			    	$(".opennew").click(function(e){
			        e.preventDefault();
			        $("#cover").css("display","block");
			        $("#cover").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        /*$("#cover-content").animate({
			            width: "300px",
			            height: "300px",
			        },800);*/
			    });
			    $(".close").click(function(){
			        $("#cover").removeAttr("style");
			        $("#cover-content").removeAttr("style");
			    });
			    $(".btn4").click(function(event) {
			    	$("#cover").removeAttr("style");
			        $("#cover-content").removeAttr("style");
			    	$('.hhh').css('display', 'block');
			    });
			    $(".chongqi").click(function(event) {
			    	$(".hhh").css('display', 'none');
			    });
			});
		  </script> 
        
    </head>
    <body>
    	<div class="bigbox2">
    		<nav class="nav2">
    			<span class="scolor"></span>
    			<ul>
    				<li><a href="<%=basePath %>page/originalIndex.jsp"><p class="mline"><span class="smallicon"></span><span class="navtxt">首 页</span></p></a></li>
    				<li><a href="<%=basePath %>client/findByIndex.action" id="sline"><p class="mline"><span class="smallicon one1" id="current21"></span><span class="navtxt" id="current2">客 户</span></p></a></li>
    				<li><a href="<%=basePath %>sale/findSale.action"><p class="mline"><span class="smallicon one2"></span><span class="navtxt">销 售 机 会</span></p></a></li>
    				<li><a href="<%=basePath %>contact/page.action"><p class="mline"><span class="smallicon one3"></span><span class="navtxt">联 系 人</span></p></a></li>
    				<li><a href="<%=basePath %>contract/findByAlls.action"><p class="mline"><span class="smallicon one4"></span><span class="navtxt">合 同</span></p></a></li>
    				<li class="shenpi"><a href="<%=basePath %>page/pacts.jsp"><p class="mline"><span class="smallicon one8"></span><span class="navtxt">合 同 审 批</span></p></a></li>
    				<c:if test="${sessionScope.backstage == 1}">
   						<li><a href="<%=basePath %>staff/selectTree.action"><p class="mline"><span class="smallicon one5"></span><span class="navtxt">后 台 管 理</span></p></a></li>
    				</c:if>
    			</ul>
    		</nav>
    		<div class="showbox3">
	    		<p class="xtitle">客 户 详 情</p>
	    		<span class="boxone">
	    		<div class="above">
	    			<img src="<%=basePath %>images/kehu (1).png" alt="" class="po"> 
		    		<span class="salename">
		    		&nbsp;${newClientUtil.client.client_name}

		    		</span>
		    		<span class="open">
		    			<span class="opennew">编 辑</span>
		    		</span>
	    		</div>
		    	<ul class="sun sun2">
		    		<li>
		    			<span class="sone">客户类型</span><br>
		    			<span class="stwo">默认业务类型</span>
		    		</li>
		    		<li>
		    			<span class="sone">公司网址</span><br>
		    			<span class="stwo">${newClientUtil.information.information_website}</span>
		    		</li>
		    		<li>
		    			<span class="sone">电话</span><br>
		    			<span class="stwo">${newClientUtil.information.information_phone}</span>
		    		</li>
		    		<li>
		    			<span class="sone">所属公海</span><br>
		    			<span class="stwo"></span>
		    		</li>
		    		<li>
		    			<span class="sone">客户所有人</span><br>
		    			<span class="stwo">${newClientUtil.staff}</span>
		    		</li>
		    		
		    	</ul>		
	    		</span> 
	    		<div class="b-box"></div>	   		
    		</div>
    		<div class="showbox3 showbox4">
	    		  <div class="boxtwo">
	    		  
	    		  	
	    		  	<div class="boxthree">
	    		  		<span class="threenav threenav2">
	    		  			<a href="<%=basePath %>SaleTrack/findClientId.action?id=${newClientUtil.client.client_id}">动态</a>
	    		  			<a href="#" class="fg fg2">资料</a>
	    		  		</span>
	    		  		<div class="formdan">
	    		  			<p>基本信息</p>
	    		  			<ul class="basictxt">
	    		  				<li>
	    		  					<span class="crazy">客户所有人</span>
	    		  					<span class="crazy2">${newClientUtil.staff}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">客户名称</span>
	    		  					<span class="crazy2">${newClientUtil.client.client_name}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">客户级别</span>
	    		  					<span class="crazy2">${newClientUtil.rank}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">上级客户</span>
	    		  					<span class="crazy2">${newClientUtil.client.client_parent}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">行业</span>
	    		  					<span class="crazy2">${newClientUtil.tradeManages}</span>
	    		  				</li>
	    		  			</ul>
	    		  			<p>其他信息</p>
	    		  			<ul class="basictxt">
	    		  				<li>
	    		  					<span class="crazy">总人数</span>
	    		  					<span class="crazy2">${newClientUtil.client.client_headcount}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">销售额</span>
	    		  					<span class="crazy2">${newClientUtil.client.client_saleroom}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">所在区域</span>
	    		  					<span class="crazy2">
	    		  						<span id="information_province">${newClientUtil.information.information_province}</span>
	    		  						<span id="information_city">${newClientUtil.information.information_city}</span>
	    		  						<span id="information_area">${newClientUtil.information.information_area}</span>
	    		  					</span>
	    		  				</li>
	    		  			</ul>
	    		  			<p>公海信息</p>
	    		  			<ul class="basictxt">
	    		  				<li>
	    		  					<span class="crazy">最新跟进人</span>
	    		  					<span class="crazy2">${newClientUtil.communal.communal_followName}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">创建日期</span>
	    		  					<span class="crazy2"><fmt:formatDate value="${newClientUtil.communal.communal_creationDate}" type="date" /></span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">创建人</span>
	    		  					<span class="crazy2">${newClientUtil.communal.communal_creater}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">最新修改日</span>
	    		  					<span class="crazy2"><fmt:formatDate value="${newClientUtil.communal.communal_amendDate}" type="date"/></span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">最新修改人</span>
	    		  					<span class="crazy2">${newClientUtil.communal.communal_amendName}</span>
	    		  				</li>
	    		  				<li>
	    		  					<span class="crazy">备注</span>
	    		  					<span class="crazy2">${newClientUtil.communal.communal_remarks}</span>
	    		  				</li>
	    		  			</ul>
	    		  		</div>
	    		  		
	    		  		

	    		  	</div>
	    		  </div>		
    		</div>
    		<div id="cover">
			    		<div id="cover-bg"></div>
						<div id="cover-content">
								<h4>编 辑 客 户<span class="close"></span></h4>
								<p class="main">
									<span class="leftmain">客 户 名 称</span>
									<input type="text" id="client_name" value="${newClientUtil.client.client_name}" placeholder="&nbsp;&nbsp;请输入客户的姓名 " class="shurukuang shurukuang2 shurukuang22">
								</p>
								<p class="main">
									<span class="leftmain" >省 份&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
									<select id="sheng" name="province3" class="shenfenselect shenfenselect4">
							        </select>
							        <select id="shi" name="city3" class="shenfenselect shenfenselect2 shenfenselect4">
							        </select>
							        <select id="xiang" name="area3" class="shenfenselect shenfenselect2 shenfenselect4">
							        </select>
								</p>
								<p class="main">
									<span class="leftmain">详 细 地 址</span>
									<input type="text" id="information_address" value="${newClientUtil.information.information_address}" placeholder="&nbsp;&nbsp;请输入详细地址 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">电 话&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
									<input type="text" id="information_phone" value="${newClientUtil.information.information_phone}" placeholder="&nbsp;&nbsp;请输入电话 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">备 注&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
									<input type="text" id="information_remarks" value="${newClientUtil.information.information_remarks}" placeholder="&nbsp;&nbsp;请输入备注 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">所 属 部 门</span>
									<select id="department_id" class="shenfenselect shenfenselect3">
							            <c:forEach items="${departments}" var="department">
							            	<option value="${department.department_id}">${department.department_name}</option>
							            </c:forEach>
							        </select>
								</p>
								<p class="main">
									<span class="leftmain">客 户 级 别</span>
									<select id="rankId" class="shenfenselect shenfenselect3">
							            <c:forEach items="${ranks}" var="rank">
							            	<option value="${rank.rankId}">${rank.rankName}</option>
							            </c:forEach>
							        </select>
								</p>
								<p class="main">
									<span class="leftmain">上 级 客 户</span>
									<input type="text" id="client_parent" value="${newClientUtil.client.client_parent}" class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">行 业&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
									<select id="tradeManageId" class="shenfenselect shenfenselect3">
							            <c:forEach items="${tradeManages}" var="tradeManage">
							            	<option value="${tradeManage.tradeManageId}">${tradeManage.tradeName}</option>
							            </c:forEach>
							        </select>
								</p>
								<p class="main">
									<span class="leftmain">邮 政 编 码</span>
									<input type="text" id="information_postalcode" value="${newClientUtil.information.information_postalcode}" class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">传 真&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
									<input type="text" id="information_fax" value="${newClientUtil.information.information_fax}" placeholder="&nbsp;&nbsp;请输入传真 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">公 司 网 址</span>
									<input type="text" id="information_website" value="${newClientUtil.information.information_website}" placeholder="&nbsp;&nbsp;请输入公司网址 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">微 博&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
									<input type="text" id="information_microblog" value="${newClientUtil.information.information_microblog}" placeholder="&nbsp;&nbsp;请输入微博 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">总人数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
									<input type="text" id="client_headcount" value="${newClientUtil.client.client_headcount}" placeholder="&nbsp;&nbsp;请输入总人数 " class="shurukuang">
								</p>
								<p class="main">
									<span class="leftmain">销售额（元）</span>
									<input type="text" id="client_saleroom" value="${newClientUtil.client.client_saleroom}" placeholder="&nbsp;&nbsp;请输入销售额 " class="shurukuang shurukuang2">
								</p>
								<p class="main">
									<button class="btn1 btn2" onclick="saveContract()">保存</button>
									<button class="btn1 btn3">取消</button>
								</p>
			    		</div>
					 	</div>
    		</div>
    		<div id="idsssssss">
    			<p id="client_id">${newClientUtil.client.client_id}</p>
    			<p id="informationID">${newClientUtil.client.informationID}</p>
    			<p id="communalID">${newClientUtil.client.communalID}</p>
    			<p id="department_ID">${newClientUtil.client.departmentID}</p>
    			<p id="rank_id">${newClientUtil.client.rankID}</p>
    			<p id="vocation_id">${newClientUtil.client.vocationID}</p>
    		</div>
    		
    </body>
    <script type="text/javascript" defer>
    	new PCAS("province3","city3","area3");
    </script>
    <script type="text/javascript">
	    function saveContract(){
	    	var client_id = $("#client_id").html();
	    	if(client_id == ""){
	    		alert("发生未知错误为空");
	    		return;
	    	}
	    	var communalID = $("#communalID").html();
	    	var information_id = $("#informationID").html();
	    	var client_name = $("#client_name").val();
	    	var sheng = $("#sheng option:selected").val();
	    	var shi = $("#shi option:selected").val();
	    	var xiang = $("#xiang option:selected").val();
	    	var information_province = null;
	    	var information_city = null;
	    	var information_area = null;
	    	if(sheng != ""){
	    		information_province = sheng;
	    		information_city = shi;
		    	information_area = xiang;
	    	}
	    	var department_id = $("#department_id option:selected").val();
	    	var rankID = $("#rankId option:selected").val();
	    	var information_address = $("#information_address").val();
	    	var information_phone = $("#information_phone").val();
	    	var information_remarks = $("#information_remarks").val();
	    	var client_parent = $("#client_parent").val();
	    	var vocationID = $("#tradeManageId option:selected").val();
	    	var information_postalcode = $("#information_postalcode").val();
	    	var information_fax = $("#information_fax").val();
	    	var information_website = $("#information_website").val();
	    	var information_microblog = $("#information_microblog").val();
	    	var client_headcount = $("#client_headcount").val();
	    	var client_saleroom = $("#client_saleroom").val();
	    	var usdata = {information_province:information_province,client_id:client_id,communal_id:communalID,information_id:information_id,
	    			client_name:client_name,information_province:information_province,departmentID:department_id,
	    			rankID:rankID,information_address:information_address,information_phone:information_phone,information_remarks:information_remarks,
	    			client_parent:client_parent,vocationID:vocationID,information_postalcode:information_postalcode,
	    			information_fax:information_fax,information_website:information_website,information_microblog:information_microblog,
	    			client_headcount:client_headcount,client_saleroom:client_saleroom,information_city:information_city,information_area:information_area};
	    	$.ajax({
				type:"post",
				url:"<%=basePath %>client/update.action",
				data:usdata,
				success:function(data){
					alert(data);
					if(data == "修改成功"){
						location.href="<%=basePath %>client/findByClientId.action?id="+client_id;
					}
				},
				error:function(e){
					alert("发生未知错误请刷新页面");
					location.href="<%=basePath %>client/findByClientId.action?id="+client_id;
				}
	
	   		 });
	    }
	    $("#idsssssss").hide();
	    
	    var department_ID = $("#department_ID").html();
	    var vocation_id = $("#vocation_id").html();
	    var rank_id = $("#rank_id").html();
	    $("#department_id").find("option[value='"+department_ID+"']").attr("selected",true);
	    $("#tradeManageId").find("option[value='"+vocation_id+"']").attr("selected",true);
	    $("#rankId").find("option[value='"+rank_id+"']").attr("selected",true);
		/* var information_province = $("#information_province").html();
		var information_city = $("#information_city").html();
		var information_area = $("#information_area").html();
		$("#sheng").appent("<option value="+information_province+">"+information_province+"</option>");
		$("#shi").appent("<option value="+information_city+">"+information_city+"</option>");
		$("#sheng").appent("<option value="+information_area+">"+information_area+"</option>");
		$("#shi").find("option[value='"+information_city+"']").attr("selected",true);
		$("#xiang").find("option[value='"+information_area+"']").attr("selected",true); */
    </script>
</html>
